﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ManageTicket.Partner
{
    public partial class frmQuickSearchProvider : Form
    {
        public frmQuickSearchProvider(ArrayList arr)
        {
            InitializeComponent();
            arrSearchResult = arr;
        }

        ArrayList arrSearchResult;
        public ArrayList arrResult;

        private void frmQuickSearchProvider_Load(object sender, EventArgs e)
        {
            lvwProvider.Items.Clear();
            ListViewItem item;

            foreach (DataObjects.Provider oPro in arrSearchResult)
            {
                item = new ListViewItem();
                item.Text = oPro.ProviderId;
                item.SubItems.Add(oPro.ProviderName);
                lvwProvider.Items.Add(item);
                lblCount.Text = "Tổng: " + lvwProvider.Items.Count.ToString();
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            arrResult = new ArrayList();
            DataObjects.Provider oPro;
            foreach (ListViewItem item in lvwProvider.CheckedItems)
            {
                oPro = new DataObjects.Provider();
                oPro.ProviderId = item.Text;
                oPro.ProviderName = item.SubItems[1].Text;
                arrResult.Add(oPro);
            }
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            arrResult = new ArrayList();
            this.Close();
        }
    }
}
